home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************
- HTBSwitch.dll
-
- HTBswitch.cpp
-
- Copyright 1999 TransEra Corporation
-
- *****************************************************/
- #include "stdafx.h"
- #include "HTBswitch.h"
- #include "DialogThread.h"
- #include "SwitchDlg.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- short g_Xpos;
- short g_Ypos;
- long * g_pBasicVar;
- short * RetVal;
- SwitchDlg * g_SwitchVar;
-
- BEGIN_MESSAGE_MAP(CHTBswitchApp, CWinApp)
- //{{AFX_MSG_MAP(CHTBswitchApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- CHTBswitchApp::CHTBswitchApp()
- {
- }
-
- CHTBswitchApp theApp;
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: Switch
-
- Description: starts the switch from HTBasic
-
- Return type: void
- Argument: long* pBasicVar
- Argument: short * ShortPtr
- Argument: short xpos
- Argument: short ypos
-
- Notes: This function takes input from HTBasic as parameters
- it also establishes communication between HTBasic and
- the user input from teh mouse to turn the switch on and
- off.
-
- */
- void Switch(long* pBasicVar, short * ShortPtr, short xpos, short ypos)
- {
- g_Xpos = xpos;
- g_Ypos = ypos;
-
- if (g_SwitchVar == NULL)
- {
- g_pBasicVar = pBasicVar;
- RetVal = ShortPtr;
- CWinThread * pThread = AfxBeginThread(RUNTIME_CLASS (DialogThread)); // create thread to execute dialog
- }
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: Closeswitch
-
- Description: Closes switch
-
- Return type: void
-
- Notes: Closes switch and shuts it down along with the
- worker thread that it was running on.
-
- */
- void Closeswitch()
- {
- if (g_SwitchVar != NULL)
- {
- g_SwitchVar->KillTimer(1); // stop timer from updating dialog
- g_SwitchVar->EndDialog(1); // tell dialog to end
- g_SwitchVar = NULL; // set pointer to NULL to show no dialog running (dialog is still shutting down)
-
- }
- }
-